package com.helen.exam03.Service;/*
 *@Author: helen
 *@Date:   2021/5/11 16:01
 *@Description:
 */

import com.helen.exam03.Config.CsvConfig;
import com.helen.exam03.DataCsv.CsvData;
import com.helen.exam03.DataCsv.TransferChinese;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.io.IOException;

@Service
public class DataUpdateService {
    //每天1点进行数据更新

    @Scheduled(cron = "0 0 1 * * *")
    public void updateData() throws IOException {
        CsvConfig.list = CsvData.handleResource(CsvData.readAResource(CsvConfig.DATA_URL));
        TransferChinese.transferToChinese(CsvConfig.list);
        System.out.println("今日数据更新成功！");
    }
}
